<?php

	include "../controller/ConectBanco.php";

class ApnDAO{

	function insert(Apn $apn){
	    									
		mysql_query("INSERT INTO apn SET  apn = '". $apn->getApn()."'
								    	, apnUser = '". $apn->getApnUser()."'
										, apnPass = '". $apn->getApnPass()."'")	or die (mysql_error());	
		
		header("location:../view/ListaApn.php");
		
	}
	
	function delete($idapn){
		mysql_query("DELETE FROM apn WHERE idapn =".$idapn) or die (mysql_error());	
		
		header("location:../view/ListaApn.php");
	}
	
	function update(Apn $apn){
		mysql_query("UPDATE apn SET apn = '".$apn->getApn()."'
						    	  , apnUser = '". $apn->getApnUser()."'
								  , apnPass = '". $apn->getApnPass()."'
								    WHERE idapn='".$apn->getIdapn()."'") or die (mysql_error());	
		
		header("location:../view/ListaApn.php");
	}
}	
	
?>
